package cn.com.duiba.millionaire.center.biz.dao.impl;

import cn.com.duiba.millionaire.center.biz.constants.DatabaseSchema;
import cn.com.duiba.millionaire.center.biz.dao.BaseDao;
import cn.com.duiba.millionaire.center.biz.dao.MillionaireAppConfigDao;
import cn.com.duiba.millionaire.center.biz.entity.MillionaireAppConfigEntity;
import org.springframework.stereotype.Repository;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by sunchangji on 2018/2/24.
 */
@Repository("millionaireAppConfigDao")
public class MillionaireAppConfigDaoImpl extends BaseDao implements MillionaireAppConfigDao {

    @Override
    public int batchInsert(List<MillionaireAppConfigEntity> entities) {
        return this.insert("batchInsert", entities);
    }

    @Override
    public int deleteByIds(List<Long> appIds) {
        return this.delete("deleteByIds", appIds);
    }

    @Override
    public List<Long> findAppIdByPropName(String propName) {
        Map<String, Object> params = new HashMap<>();
        params.put("propName", propName);
        return this.selectList("findAppIdByPropName", params);
    }

    @Override
    public List<Long> filterAppIds(List<Long> appIds) {
        return selectList("filterAppIds",appIds);
    }


    @Override
    protected DatabaseSchema chooseSchema() {
        return DatabaseSchema.MILLIONAIRE_CONFIG;
    }
}
